package com.zhixiang.xaec.action.demo;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zhixiang.core.web.action.BaseAction;
import com.zhixiang.xaec.entity.demo.Book;
import com.zhixiang.xaec.entity.demo.Reader;
import com.zhixiang.xaec.service.demo.BookService;

@Controller
@Scope("prototype")
public class BookAction extends BaseAction
{

    private static final long serialVersionUID = -5177218570715978890L;

    private Book book;
    
    @Resource(type=BookService.class)
    private BookService bookService;

    public Book getBook()
    {
        return book;
    }

    public void setBook(Book book)
    {
        this.book = book;
    }
    
    public String save(){
        Book book = new Book();
        Reader re = new Reader();
        book.setReader(re);
        bookService.save(book);
        return SUCCESS;
        
    }
}
